Skip to content

Conversation

@Johnabell
Copy link
Contributor

This PR addresses the issue raise in #520.

It adds a new macro that only outputs the tokens when this crate is running under test. This can then be used in other macros outputs in place of #[cfg(test)] to ensure that when foreign crates use the exported macros the do not get the parts intended for internal testing.

The other option that could be considered is making a "testing" feature if you would like these to be available for testing in foreign crates too.

@Johnabell Johnabell force-pushed the fix-unit-tests-foreign-crates-unit-macro branch 2 times, most recently from 53dfc35 to c090850 Compare June 6, 2025 20:07
@TheComamba
Copy link
Contributor

Are the merge conflicts preventing this PR from being merged? I think the issue resolved by it is stopping several people from using uom 0.37.

@Johnabell Johnabell force-pushed the fix-unit-tests-foreign-crates-unit-macro branch from c090850 to 795b630 Compare December 27, 2025 22:09
@Johnabell
Copy link
Contributor Author

@TheComamba I have rebased to address the conflicts

iliekturtles and others added 3 commits January 25, 2026 13:07
Where possible use an implicit return. Otherwise use an explicit
`return` with a `;` terminating the statement.
 * Add `--all-targets` argument. Add separate `cargo test --doc` because
   `--all-targets` excludes doc tests.
 * Replace deprecated `--all` argument with `--workspace`.
@iliekturtles iliekturtles force-pushed the fix-unit-tests-foreign-crates-unit-macro branch from 795b630 to 701c35a Compare January 26, 2026 02:09
@iliekturtles
Copy link
Owner

Thanks for the PR. I pushed some changes to your branch:

  • Update CI tests to capture the failure.
  • Replace test_only! with the existing test! macro.

@iliekturtles iliekturtles merged commit 8c0c03e into iliekturtles:master Jan 26, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants